// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Element from 'element-ui'


Vue.config.productionTip = false
import './assets/gloable.css'
import request from "@/utils/request"


Vue.use(Element,{size:"mini"});
Vue.prototype.request=request

import 'element-ui/lib/theme-chalk/index.css'
import jquery from "jquery";
Vue.prototype.$ = jquery;
/**
 * 导入axios
 */
 import axios from 'axios';
 //引入momentjs
 import moment from 'moment'
 Vue.prototype.moment = moment
 /**
  * 创建axios实例
  */
  let axiosInstance = axios.create({
   baseURL: 'http://localhost:8090',  //设置服务端基础路径
   timeout: 100000,  //设置超时时间
   headers: {'X-Requested-With': 'XMLHttpRequest'}  //设置请求头为Ajax请求
 });
 //设置axios实例对象为一个原型属性 ,注册为VUE的原型属性后就可以在VUE视图中使用‘this.属性名’来调用  $axios 为属性名
 Vue.prototype.$axios=axiosInstance;
 
Vue.use(Element)
Vue.config.productionTip = false


/* main.js: */
 
/*路由守卫*/
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
